import Bubble from "../../display/Bubble";
import { GameEvent } from "../../events/GameEvent";
import MainView from "../../view/MainView";
import BaseController from "../BaseController";

export default class MainController extends BaseController {
    private main_view:MainView
    start(): void {
        this.message.once(GameEvent.GAME_START,()=>{
            console.log(GameEvent.GAME_START)
            const bg=this.layer.bg_layer
            this.main_view=new MainView()
            this.layer.bg_layer.addChild(this.main_view)
            document.getElementById('splash').style.display='none'

        })
        /*this.message.on(GameEvent.ADD_CIRCLE,()=>{
            this.main_view.addOne()
        })*/
        document.getElementById('bt_add').onclick=()=>{
            this.main_view.addOne()
        }
        const allRadios = document.querySelectorAll('input[type="radio"][name="pushType"]')
        allRadios.forEach(item => {
            //console.log(radio);
            item.addEventListener('change', ()=>{
                const radio=item as HTMLInputElement
                Bubble.pushType=parseInt(radio.value)
            })
        });
    }
}